import random, re, json, os
sav = {}
t = True
if os.path.exists("./sav.dat"):#2017.9.9#
    t = False
    print("TO BE DONE")
    exit(0)
while t: 
    inp = raw_input("Input Something:")
    mat = re.findall("\d+",inp)
    ma = []
    for i in range(0,len(mat)):#2017.10.13#
        if (len(mat[i]) == 8 or len(mat[i]) == 11):
            ma.append(mat[i])
    for mati in ma:
        o = ot = list(mati)
        k = int((len(o)+1)/2)
        print(k)
        jj=[]
        for j in range(0,len(o)):
            jj.append(j)
        d = random.sample(jj,k)
        for i in d:
            o[i] = "0"
        r = ""
        for w in o:
            r = r + w
        print("Raw:"+mati)
        print("Encrypted:"+r)#2017.9.9#
        sav[str(mati)] = r
    if input("Do you want to continue?[Y/n]:") == "n":
        t = False
with open("sav.dat","x") as f:
    json.dump(sav,f)
